<template>
  <div class="checkNews">
    <img class="backImg" :src="imgSrc" alt="..." @mouseenter="enterImg()" @mouseleave="leaveImg()" @click="clickImg" >
    <!-- 内容 -->
    <div class="contentDiv">
      <div class="headerTitle"><h1>{{newsDataOne.newsTitle}}</h1></div>
      <div class="centerLabel">
        <div>{{newsDataOne.newsAuthor}}</div>
        <div>{{newsDataOne.newsTime}}</div>
      </div>
      <div class="footerContent">{{newsDataOne.newsContent}}</div>
    </div>
  </div>
</template>

<script>
import { axiosRequest } from "@/utils/axiosRequest";
export default {
  data() {
    return {
      imgSrc: require("../../assets/img/back1.svg"),
      newsDataOne: [],
    }
  },

  methods: {
    // 鼠标移入返回图片事件
    enterImg() {
      var self = this;
      self.imgSrc = require("../../assets/img/back2.svg")
    },

    // 鼠标移出返回图片事件
    leaveImg() {
      var self = this;
      self.imgSrc = require("../../assets/img/back1.svg");
    },

    // 点击返回图片事件
    clickImg() {
      window.history.back();
    },

    // 通过id请求到通知信息的内容
    asknewsById() {
      var self = this;
      var newsId = self.$route.query.id;
      axiosRequest("get", "/news/"+newsId).then((res) => {
            if (res.data.code === 200) {
                self.newsDataOne = res.data.data;
            } else {
                self.$message.error(res.data.data);
            }
        });
    },
  },

  created: function () {
    this.asknewsById();
  },
}
</script>

<style lang="less" scoped>
.checkNews {
  padding-left: 10px;
}

.backImg {
  width: 30px;
  height: 30px;
  margin-left: 10px;
  margin-top: 10px;
  cursor: pointer;
}

.contentDiv {
  width: 100%;
  height: 100%;
  margin-top: 15px;
}

.headerTitle {
  text-align: center;
  font-family:"微软雅黑", "宋体", "黑体", Arial;
  font-size: 20px;
  font-weight: 1000;
  height: 25px;
  line-height: 25px;
  margin: 18px 0;
  padding: 8px 0 5px 5px;
  letter-spacing: 3px;
  line-height: 35px;
  text-shadow : rgba(255,255,255,0.5) 0 5px 6px, rgba(255,255,255,0.2) 1px 3px 3px;
}

.centerLabel {
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid rgb(105, 105, 105);
  margin-top: 45px;
  padding: 15px 0px;
}

.footerContent {
  width:80%;
  text-indent: 20px;
  margin: 0 auto;
  margin-top: 20px;
  padding: 5px 20px;
  font-size: 18px;
  letter-spacing: 2px;
  line-height: 35px;
}

</style>
